<html>
<head><meta charset="utf-8"><title>point at method call PR #65951 · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/point.20at.20method.20call.20PR.20.2365951.html">point at method call PR #65951</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="183203764"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/point%20at%20method%20call%20PR%20%2365951/near/183203764" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/point.20at.20method.20call.20PR.20.2365951.html#183203764">(Dec 11 2019 at 21:29)</a>:</h4>
<p>Actually <span class="user-mention" data-user-id="119031">@Esteban Küber</span> let's discuss here =)</p>



<a name="183204305"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/point%20at%20method%20call%20PR%20%2365951/near/183204305" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/point.20at.20method.20call.20PR.20.2365951.html#183204305">(Dec 11 2019 at 21:34)</a>:</h4>
<p>In particular, <span class="user-mention" data-user-id="119031">@Esteban Küber</span>, I think the data that is being stored in<code>node_method_def_id</code> table is also available from the <code>type_dependent_defs</code> table</p>



<a name="183204323"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/point%20at%20method%20call%20PR%20%2365951/near/183204323" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/point.20at.20method.20call.20PR.20.2365951.html#183204323">(Dec 11 2019 at 21:35)</a>:</h4>
<p>we currently call <a href="https://github.com/rust-lang/rust/blob/90b957a17c1abba979aa41234ce0993a61030e67/src/librustc_typeck/check/mod.rs#L2820" target="_blank" title="https://github.com/rust-lang/rust/blob/90b957a17c1abba979aa41234ce0993a61030e67/src/librustc_typeck/check/mod.rs#L2820"><code>write_method_call</code></a></p>



<a name="183204347"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/point%20at%20method%20call%20PR%20%2365951/near/183204347" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/point.20at.20method.20call.20PR.20.2365951.html#183204347">(Dec 11 2019 at 21:35)</a>:</h4>
<p>which then invokes <a href="https://github.com/rust-lang/rust/blob/90b957a17c1abba979aa41234ce0993a61030e67/src/librustc_typeck/check/mod.rs#L2816" target="_blank" title="https://github.com/rust-lang/rust/blob/90b957a17c1abba979aa41234ce0993a61030e67/src/librustc_typeck/check/mod.rs#L2816"><code>write_resolution</code></a> which stores <code>method.def_id</code>into that table</p>



<a name="183204358"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/point%20at%20method%20call%20PR%20%2365951/near/183204358" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/point.20at.20method.20call.20PR.20.2365951.html#183204358">(Dec 11 2019 at 21:35)</a>:</h4>
<p>I'll leave comments on the PR, anyhow</p>



<a name="183204565"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/point%20at%20method%20call%20PR%20%2365951/near/183204565" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Esteban Küber <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/point.20at.20method.20call.20PR.20.2365951.html#183204565">(Dec 11 2019 at 21:38)</a>:</h4>
<p>If that is the case, it should be easy to change</p>



<a name="183204608"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/point%20at%20method%20call%20PR%20%2365951/near/183204608" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Esteban Küber <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/point.20at.20method.20call.20PR.20.2365951.html#183204608">(Dec 11 2019 at 21:38)</a>:</h4>
<p>And it's great that then we won't have any extra perf/mem-use hit</p>



<a name="183204629"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/point%20at%20method%20call%20PR%20%2365951/near/183204629" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Esteban Küber <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/point.20at.20method.20call.20PR.20.2365951.html#183204629">(Dec 11 2019 at 21:39)</a>:</h4>
<p>What about the function <code>foo()</code> → <code>foo&lt;T&gt;()</code> case?</p>



<a name="183204656"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/point%20at%20method%20call%20PR%20%2365951/near/183204656" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/point.20at.20method.20call.20PR.20.2365951.html#183204656">(Dec 11 2019 at 21:39)</a>:</h4>
<p>not sure what you mean by that, <span class="user-mention" data-user-id="119031">@Esteban Küber</span> ?</p>



<a name="183204660"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/point%20at%20method%20call%20PR%20%2365951/near/183204660" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Esteban Küber <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/point.20at.20method.20call.20PR.20.2365951.html#183204660">(Dec 11 2019 at 21:39)</a>:</h4>
<p>That one is a bit hackier than I'd like, because at that point we no longer have the PathSegment anymore</p>



<a name="183204663"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/point%20at%20method%20call%20PR%20%2365951/near/183204663" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Esteban Küber <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/point.20at.20method.20call.20PR.20.2365951.html#183204663">(Dec 11 2019 at 21:39)</a>:</h4>
<p>one sec</p>



<a name="183204666"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/point%20at%20method%20call%20PR%20%2365951/near/183204666" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/point.20at.20method.20call.20PR.20.2365951.html#183204666">(Dec 11 2019 at 21:39)</a>:</h4>
<p>you mean inspecting the snippet?</p>



<a name="183204766"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/point%20at%20method%20call%20PR%20%2365951/near/183204766" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Esteban Küber <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/point.20at.20method.20call.20PR.20.2365951.html#183204766">(Dec 11 2019 at 21:40)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/pull/65951/files#diff-0e12890ad498e250783f40f88a8b8ec6R1997-R2042" target="_blank" title="https://github.com/rust-lang/rust/pull/65951/files#diff-0e12890ad498e250783f40f88a8b8ec6R1997-R2042">https://github.com/rust-lang/rust/pull/65951/files#diff-0e12890ad498e250783f40f88a8b8ec6R1997-R2042</a></p>



<a name="183204768"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/point%20at%20method%20call%20PR%20%2365951/near/183204768" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Esteban Küber <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/point.20at.20method.20call.20PR.20.2365951.html#183204768">(Dec 11 2019 at 21:40)</a>:</h4>
<p>yep</p>



<a name="183204781"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/point%20at%20method%20call%20PR%20%2365951/near/183204781" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/point.20at.20method.20call.20PR.20.2365951.html#183204781">(Dec 11 2019 at 21:40)</a>:</h4>
<p>Yeah I'm not sure what's better there</p>



<a name="183204792"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/point%20at%20method%20call%20PR%20%2365951/near/183204792" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/point.20at.20method.20call.20PR.20.2365951.html#183204792">(Dec 11 2019 at 21:40)</a>:</h4>
<p>Rigth now I'm imagining this could still give false suggestions</p>



<a name="183204808"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/point%20at%20method%20call%20PR%20%2365951/near/183204808" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/point.20at.20method.20call.20PR.20.2365951.html#183204808">(Dec 11 2019 at 21:40)</a>:</h4>
<p>It looks like you are testing that there <em>are</em> generic parameters</p>



<a name="183204847"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/point%20at%20method%20call%20PR%20%2365951/near/183204847" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/point.20at.20method.20call.20PR.20.2365951.html#183204847">(Dec 11 2019 at 21:41)</a>:</h4>
<p>but I think that may not be enough</p>



<a name="183205051"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/point%20at%20method%20call%20PR%20%2365951/near/183205051" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/point.20at.20method.20call.20PR.20.2365951.html#183205051">(Dec 11 2019 at 21:43)</a>:</h4>
<p>well</p>



<a name="183205066"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/point%20at%20method%20call%20PR%20%2365951/near/183205066" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/point.20at.20method.20call.20PR.20.2365951.html#183205066">(Dec 11 2019 at 21:44)</a>:</h4>
<p>I guess that it's probably true that <em>one</em> of the parameters needs to be constrained</p>



<a name="183205132"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/point%20at%20method%20call%20PR%20%2365951/near/183205132" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/point.20at.20method.20call.20PR.20.2365951.html#183205132">(Dec 11 2019 at 21:44)</a>:</h4>
<p>even if the connection to the return type might not be <em>direct</em></p>



<a name="183205138"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/point%20at%20method%20call%20PR%20%2365951/near/183205138" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/point.20at.20method.20call.20PR.20.2365951.html#183205138">(Dec 11 2019 at 21:44)</a>:</h4>
<p>so perhaps it <em>is</em> correct as is</p>



<a name="183220548"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/point%20at%20method%20call%20PR%20%2365951/near/183220548" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Esteban Küber <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/point.20at.20method.20call.20PR.20.2365951.html#183220548">(Dec 12 2019 at 01:26)</a>:</h4>
<p>I believe the common case will be only one of the available type params needs to be constrained, as the rest are being properly inferred. There are three follow up things to do for that PR to be perfect: look at the current resolved type for all type params, do that even when the turbofish is being used already, and finally try to perform some global evaluation to try to infer what the appropriate type would be. I am not handling any of those cases yet under the assumption that 1) the common case will only involve a single type param (suspect assumption), 2) that this will have the most benefit for newcomers that do not yet know about the turbofish syntax, 3) that doing those things will be hard and 4) landing a smaller improvement sooner is better than a full solution later.</p>



<a name="183315385"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/point%20at%20method%20call%20PR%20%2365951/near/183315385" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Esteban Küber <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/point.20at.20method.20call.20PR.20.2365951.html#183315385">(Dec 12 2019 at 23:53)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I feel that <a href="https://github.com/rust-lang/rust/pull/65951" target="_blank" title="https://github.com/rust-lang/rust/pull/65951">https://github.com/rust-lang/rust/pull/65951</a> is as ready as it will be in the short term for merging. The outstanding comments seem like something I should tackle but wouldn't want them to block the landing of the PR.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>